import axios from 'axios'
const baseURL= 'https://e.haimingroup.com'
const testURL= 'http://hmonline.wuxian.com'
const request = axios.create({
  baseURL: '/api',
  timeout: 10000
})

request.interceptors.request.use(config => {
  if (config.method && config.method.toLowerCase() !== 'get') {
    config.headers['Content-Type'] = 'application/json'
  }
  return config
})

request.interceptors.response.use(
  response => response.data,
  error => Promise.reject(error)
)

export default request